/**
 * JLego standard javascript library
 * 
 */
var OREG = {};
OREG.contextPath = '';

OREG.authenticate = function (payload, successHandler, errorHandler){
	AJS.$.ajax({
		type: 'POST',
		url: OREG.contextPath + '/auth',
		data: {
			serviceName: 'authenticate',
			payload: JSON.stringify(payload)
		},
		success: successHandler,
		error: errorHandler
	});
}
OREG.callHook = function (serviceName, payload, successHandler, errorHandler){
	// Call 'ServiceHook'
	AJS.$.ajax({
		type: 'POST',
		url: OREG.contextPath + '/' + serviceName, //'/hook/service',
		data: {
			serviceName: serviceName,
			payload: JSON.stringify(payload)
		},
		success: successHandler,
		error: errorHandler
	});
}
